<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>属性与自定义属性操作</title>
</head>

<body>
    <button id="btn">你过来呀</button>
    <br>
    <img src="./img/3.png" width="450px" alt="" id="liuxiaolan" love="xiaolanlan" title="全世界最美丽的女人">
</body>

</html>
<script>
    let liuxiaolan = window.document.querySelector('#liuxiaolan');
    let btn = window.document.querySelector('#btn');
    let count = 0;
    btn.onclick = function(params) {
        if (count == 3) {
            btn.innerText = '我过来了';
            count = 0;
        } else {
            btn.innerText = '你过来呀';
        }
        liuxiaolan.setAttribute('src', './img/' + ++count + '.png');
    };
</script>